-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge to master #108
Merge to master #108
Conversation
- Update the Makefile - Fix glyphs and use those from sdk - Remove hardcoded files
- Update and cleanup error codes - Add constant defines - Fix Select missing tag - Add missing General Feature Management Tag - Syntax and formatting - Remove TRY/CATCH - Cleanup THROW/return statements - Remove usuless goto - improve readability - Use ledger_assert - Improve popup messages - Remove flag GPG_SHAKE256; same code for all devices - Optimize PIN counter write and correct return code - Cleanup ux code - Factorization - Add indication in About menu for debug build - Use global label constants
- Fix APDU Set Slot to refresh the current key slot - Fix Manage Security Environment bad parameter - Fix set offset in APDU buffer (io buffers) - Fix ui_info empty string - Fix Nanos Main menu bad display
- Only a single slot for "Nanos" - 3 slots for other platforms - No more Variants to manage, only OpenPGP is a valid App Name
- Remove support of "On Host" - Add warnning message if user select "Trust"
- Set SEED mode On at startup - Add a warning if the user disables it
- Helper script to ease the command to - Generate keys - Encrypt / Decrypt - Sign / Verify
- Align README with default Boilerplate content - Update README with Tests and Documentation details - README few formatting - Update OpenPGP Specifications to 3.3 - Update the Developer and User documentations (formatting, rewritting, adding new elements...) - PDF generation of both Developer and User documents - Provide patch file to update CCID driver with correct Ledger device Ids - Use the renamed app-openpgp
B2CA-969: clean and port stax
- Replace 'pycard' by 'ledgercomm', allowint to work also with 'speculos' - Update 'manual-tests' allowing expert mode init with full log generation - Improve backup meachnism - Add 'seed-key' option directly to 'backup.py' for easier operation - Adapt the document accordingly
Fix App following security Audit
Causing issue with secp256r1 curve! This reverts commit 7b7bd27.
- Remove useless parameter for 'ui_info' - Remove useless functions 'gpg_init_ux' and 'io_seproxyhal_display' - Add constant definition - Unique function 'app_reset' instead of duplicate code
Issue 101: Improve doc readability
Fix DO_GEN_FEATURES empty during restore
[auto] Update Screenshots
/* Unsupported (yet) Curves | ||
case CX_CURVE_SECP384R1: | ||
*len = sizeof(C_OID_SECP384R1); | ||
return (unsigned char*)PIC(C_OID_SECP384R1); | ||
|
||
case CX_CURVE_SECP521R1: | ||
*len = sizeof(C_OID_SECP521R1); | ||
return (unsigned char*)PIC(C_OID_SECP521R1); | ||
|
||
case CX_CURVE_BrainPoolP256R1: | ||
*len = sizeof(C_OID_SECP256R1); | ||
return (unsigned char*)PIC(C_OID_SECP256R1); | ||
|
||
case CX_CURVE_BrainPoolP384R1: | ||
*len = sizeof(C_OID_SECP384R1); | ||
return (unsigned char*)PIC(C_OID_SECP384R1); | ||
|
||
case CX_CURVE_BrainPoolP512R1: | ||
*len = sizeof(C_OID_SECP521R1); | ||
return (unsigned char*)PIC(C_OID_SECP521R1); | ||
*/ |
Check notice
Code scanning / CodeQL
Commented-out code Note
/* Unsupported (yet) Curves | ||
if ( (len == sizeof(C_OID_SECP384R1)) && (memcmp(oid, C_OID_SECP384R1, len)==0) ) { | ||
return CX_CURVE_SECP384R1; | ||
} | ||
if ( (len == sizeof(C_OID_SECP521R1)) && (memcmp(oid, C_OID_SECP521R1, len)==0) ) { | ||
return CX_CURVE_SECP521R1; | ||
} | ||
|
||
if ( (len == sizeof(C_OID_BRAINPOOL256T1)) && (memcmp(oid, C_OID_BRAINPOOL256T1, len)==0) ) { | ||
return CX_CURVE_BrainPoolP256T1; | ||
} | ||
if ( (len == sizeof(C_OID_BRAINPOOL256R1)) && (memcmp(oid, C_OID_BRAINPOOL256R1, len)==0) ) { | ||
return CX_CURVE_BrainPoolP256R1; | ||
} | ||
if ( (len == sizeof(C_OID_BRAINPOOL384R1)) && (memcmp(oid, C_OID_BRAINPOOL384R1, len)==0) ) { | ||
return CX_CURVE_BrainPoolP384R1; | ||
} | ||
if ( (len == sizeof(C_OID_BRAINPOOL512R1)) && (memcmp(oid, C_OID_BRAINPOOL512R1, len)==0) ) { | ||
return CX_CURVE_BrainPoolP512R1; | ||
} | ||
*/ |
Check notice
Code scanning / CodeQL
Commented-out code Note
break; | ||
} | ||
gpg_io_fetch_tl(&t, &l); | ||
if (t != 0x86) { | ||
error = SW_WRONG_DATA; | ||
break; | ||
} | ||
|
||
// --- PSO:DEC:ECDH | ||
case 0xA6: { | ||
cx_ecfp_private_key_t *key; | ||
unsigned int sz; | ||
unsigned int curve; | ||
if (G_gpg_vstate.mse_dec->attributes.value[0] != 0x12) { | ||
THROW(SW_CONDITIONS_NOT_SATISFIED); | ||
return SW_CONDITIONS_NOT_SATISFIED; | ||
} | ||
key = &G_gpg_vstate.mse_dec->priv_key.ecfp; | ||
gpg_io_fetch_l(&l); | ||
gpg_io_fetch_tl(&t, &l); | ||
if (t != 0x7f49) { | ||
THROW(SW_WRONG_DATA); | ||
return SW_WRONG_DATA; | ||
} | ||
gpg_io_fetch_tl(&t, &l); | ||
if (t != 0x86) { | ||
THROW(SW_WRONG_DATA); | ||
return SW_WRONG_DATA; | ||
} | ||
curve = gpg_oid2curve(G_gpg_vstate.mse_dec->attributes.value + 1, | ||
G_gpg_vstate.mse_dec->attributes.length - 1); | ||
if (ecfp_key->curve != curve) { | ||
error = SW_CONDITIONS_NOT_SATISFIED; | ||
break; | ||
} | ||
if (curve == CX_CURVE_Curve25519) { | ||
for (cnt = 0; cnt <= 31; cnt++) { | ||
G_gpg_vstate.work.io_buffer[512 + cnt] = | ||
(G_gpg_vstate.work.io_buffer + G_gpg_vstate.io_offset)[31 - cnt]; | ||
} | ||
G_gpg_vstate.work.io_buffer[511] = 0x02; | ||
CX_CHECK(cx_ecdh_no_throw(ecfp_key, | ||
CX_ECDH_X, | ||
G_gpg_vstate.work.io_buffer + 511, | ||
65, | ||
G_gpg_vstate.work.io_buffer + 256, | ||
160)); | ||
CX_CHECK(cx_ecdomain_parameters_length(ecfp_key->curve, &ksz)); | ||
|
||
curve = gpg_oid2curve(G_gpg_vstate.mse_dec->attributes.value + 1, G_gpg_vstate.mse_dec->attributes.length - 1); | ||
if (key->curve != curve) { | ||
THROW(SW_CONDITIONS_NOT_SATISFIED); | ||
return SW_CONDITIONS_NOT_SATISFIED; | ||
} | ||
if (curve == CX_CURVE_Curve25519) { | ||
unsigned int i; | ||
for (cnt = 0; cnt <= 31; cnt++) { | ||
G_gpg_vstate.work.io_buffer[128 + cnt] = | ||
G_gpg_vstate.work.io_buffer[287 - cnt]; | ||
} | ||
ksz = 32; | ||
} else { | ||
CX_CHECK( | ||
cx_ecdh_no_throw(ecfp_key, | ||
CX_ECDH_X, | ||
G_gpg_vstate.work.io_buffer + G_gpg_vstate.io_offset, | ||
65, | ||
G_gpg_vstate.work.io_buffer + 128, | ||
160)); | ||
CX_CHECK(cx_ecdomain_parameters_length(ecfp_key->curve, &ksz)); | ||
} | ||
// send | ||
gpg_io_discard(0); | ||
gpg_io_insert(G_gpg_vstate.work.io_buffer + 128, ksz); | ||
error = SW_OK; | ||
break; | ||
|
||
for (i = 0; i <= 31; i++) { | ||
G_gpg_vstate.work.io_buffer[512 + i] = (G_gpg_vstate.work.io_buffer + G_gpg_vstate.io_offset)[31 - i]; | ||
} | ||
G_gpg_vstate.work.io_buffer[511] = 0x02; | ||
sz = cx_ecdh(key, CX_ECDH_X, G_gpg_vstate.work.io_buffer + 511, 65, G_gpg_vstate.work.io_buffer + 256, 160); | ||
for (i = 0; i <= 31; i++) { | ||
G_gpg_vstate.work.io_buffer[128 + i] = G_gpg_vstate.work.io_buffer[287 - i]; | ||
} | ||
sz = 32; | ||
} else { | ||
sz = cx_ecdh(key, CX_ECDH_X, G_gpg_vstate.work.io_buffer + G_gpg_vstate.io_offset, 65, | ||
G_gpg_vstate.work.io_buffer + 128, 160); | ||
} | ||
// send | ||
gpg_io_discard(0); | ||
gpg_io_insert(G_gpg_vstate.work.io_buffer + 128, sz); | ||
return SW_OK; | ||
} | ||
// --- PSO:DEC:xx NOT SUPPORTED | ||
default: | ||
error = SW_REFERENCED_DATA_NOT_FOUND; | ||
break; | ||
} |
Check notice
Code scanning / CodeQL
Long switch case Note
0 (39 lines)
Switch has at least one case that is too long:
166 (87 lines)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #108 +/- ##
=========================================
Coverage ? 27.01%
=========================================
Files ? 1
Lines ? 211
Branches ? 0
=========================================
Hits ? 57
Misses ? 154
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
https://ledgerhq.atlassian.net/browse/B2CA-969